﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace pygs.UI
{
    public class WinUI : CustomUI
    {
        private WinUIFormMain _mainForm;
        protected WinUIFormMain mainForm { get { return _mainForm; } }

        protected override void InitilizeComponent()
        {
            base.InitilizeComponent();
            _mainForm = new WinUIFormMain(this);
        }

        protected override void DoRunUI()
        {
            System.Windows.Forms.Application.Run(mainForm);
        }

        public void Exit()
        {
            DoCommand(new UICommandExit());
            mainForm.Close();
        }

        protected override void RegisterUIStatusPerformers()
        {
            base.RegisterUIStatusPerformers();

            // UIStatusLocation
            RegisterUIStatusPerformer<UIStatusLocation>(status => {
                mainForm.SetLocation(status.location.LatitudeAsDegreesMinutesSeconds, status.location.LongitudeAsDegreesMinutesSeconds);
                return true;
            });

        }
    }
}
